import type { ResponseInterface } from 'src/common/interface/response';

// 用户信息接口
export interface User {
  id: number;
  account: string;
  password: string;
  nickName: string;
  avatarUrl: string;
  avatar: string;
  cover: string;
  status: string | null;
  tags: string[] | null;
  state: string;
  signature: string | null;
  email: string | null;
  gender: 'male' | 'female' | 'unknown';
  birthday: string | null;
  friends: string[] | null;
  permission: number;
  createdAt: string;
  updatedAt: string;
}

// 存入数据库的参数
export type UserDataInterface = Pick<
  User,
  | 'account'
  | 'password'
  | 'nickName'
  | 'state'
  | 'gender'
  | 'createdAt'
  | 'updatedAt'
  | 'permission'
  | 'avatar'
>;

// 登陆接口
export type LoginParam = Pick<User, 'account' | 'password'>;
export type LoginResponse = ResponseInterface<{ id: number }>;

// 注册接口
export type RegisterParam = Pick<User, 'nickName' | 'password'>;
export type RegisterResponse = ResponseInterface<{ account: string }>;

// 获取用户详情
export type DetailsParam = { id: number };
export type DetailsResponse = ResponseInterface<User>;

// 修改用户信息
export type UpdateDetailsParam = User;
export type UpdateDetailsResponse = ResponseInterface<object>;

// 获取全部用户列表
export type QueryUsersResponse = ResponseInterface<User[]>;
